﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using LDSP.BRL;

namespace ImplementationInitialization
{
    public class ImportChemicalResult
    {
        public DataTable ChemicalResult { get; set; }

        public ImportChemicalResult()
        {
            ChemicalResult = InitialResultItemTable();
        }

        private DataTable InitialResultItemTable()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add(Constants.ImportResultColumnNames.COL_EXCEL_FILE);
            dt.Columns.Add(Constants.ImportResultColumnNames.COL_EXCEL_SHEET);
            dt.Columns.Add(Constants.ImportResultColumnNames.COL_ITEM_NAME);
            dt.Columns.Add(Constants.ImportResultColumnNames.COL_MESSAGE);
            dt.Columns.Add(Constants.ImportResultColumnNames.COL_SUCCESS);

            return dt;
        }

        public void AddItemResult(string excelFile, string excelSheet, string name, string message, bool success)
        {
            DataTable dt = ChemicalResult;
            string s = success ? "成功" : "失败";

            dt.Rows.Add(excelFile, excelSheet, name, message, s);
        }

        public void ClearChemicalResult()
        {
            ChemicalResult.Rows.Clear();
        }
    }
}
